package com.mybed.crm.result;

import lombok.Data;

import java.io.Serializable;

/**
 * 后端统一返回结果
 * @param <T>
 */
@Data
public class ResultP<T> implements Serializable {

    private Integer code; //编码：1成功，0和其它数字为失败
    private String msg=""; //错误信息



    public static <T> ResultP<T> success() {
        ResultP<T> result = new ResultP<T>();
        result.code = 200;
        result.msg="操作成功";
        return result;
    }
    public static <T> ResultP<T> success(String msg) {
        ResultP<T> result = new ResultP<T>();
        result.code = 200;
        result.msg=msg;
        return result;
    }
    public static <T> ResultP<T> Loginsuccess() {
        ResultP<T> result = new ResultP<T>();
        result.code = 200;
        result.msg="操作成功";
        return result;
    }



    public static <T> ResultP<T> error(String msg) {
        ResultP result = new ResultP();
        result.msg = msg;
        result.code = 500;
        return result;
    }

}
